package com.wx.mall.demo.feign;

import com.alibaba.fastjson.JSON;
import com.wx.mall.common.vo.user.DemoVo;
import com.wx.mall.demo.entity.Demo;
import com.wx.mall.demo.service.IDemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/feign/demo")
public class FeignDemoController {

    @Autowired
    IDemoService iDemoService;

    @GetMapping("/info")
    public DemoVo info(int id) {
        Demo demo = iDemoService.getById(id);
        return JSON.parseObject(JSON.toJSONString(demo),DemoVo.class);
    }

}
